const { app, BrowserWindow, session, ipcMain } = require('electron')
const path = require('path')
const fs = require('fs')

const {createWindow} = require('./mainwindow')
const { initcookies } = require('./cookies/index')



app.whenReady().then( async () => {
  
  createWindow()
  initcookies()


  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow()
    }
  })

})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

// 处理未捕获的错误
process.on('uncaughtException', (error) => {
  console.error('未捕获的错误:', error)
})

